# Copyright 2023 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:serving.bzl", "serving_cc_library", "serving_cc_test")

package(default_visibility = ["//visibility:public"])

serving_cc_library(
    name = "oss_client",
    srcs = ["oss_client.cc"],
    hdrs = ["oss_client.h"],
    deps = [
        "@com_aws_sdk//:aws",
        "@yacl//yacl/base:exception",
    ],
)

serving_cc_library(
    name = "sys_util",
    srcs = ["sys_util.cc"],
    hdrs = ["sys_util.h"],
    deps = [
        "//secretflow_serving/core:exception",
        "@com_github_openssl_openssl//:openssl",
    ],
)

serving_cc_library(
    name = "utils",
    srcs = ["utils.cc"],
    hdrs = ["utils.h"],
    deps = [
        "//secretflow_serving/apis:status_cc_proto",
        "//secretflow_serving/core:exception",
        "//secretflow_serving/protos:feature_cc_proto",
    ],
)

serving_cc_library(
    name = "arrow_helper",
    srcs = ["arrow_helper.cc"],
    hdrs = ["arrow_helper.h"],
    deps = [
        ":utils",
        "//secretflow_serving/core:exception",
        "//secretflow_serving/protos:data_type_cc_proto",
        "@org_apache_arrow//:arrow",
    ],
)

serving_cc_library(
    name = "thread_safe_queue",
    hdrs = ["thread_safe_queue.h"],
    deps = [
        "//secretflow_serving/core:exception",
    ],
)

serving_cc_library(
    name = "thread_pool",
    hdrs = ["thread_pool.h"],
    deps = [
        ":thread_safe_queue",
    ],
)

serving_cc_test(
    name = "arrow_helper_test",
    srcs = ["arrow_helper_test.cc"],
    deps = [
        ":arrow_helper",
    ],
)

serving_cc_library(
    name = "network",
    srcs = ["network.cc"],
    hdrs = ["network.h"],
    deps = [
        "//secretflow_serving/config:tls_config_cc_proto",
        "//secretflow_serving/core:exception",
        "@com_github_brpc_brpc//:brpc",
    ],
)

serving_cc_library(
    name = "test_utils",
    srcs = ["test_utils.cc"],
    hdrs = ["test_utils.h"],
    deps = [
        ":arrow_helper",
    ],
)

serving_cc_test(
    name = "thread_safe_queue_test",
    srcs = ["thread_safe_queue_test.cc"],
    deps = [
        ":thread_safe_queue",
    ],
)
